// 配置项
// https://vue-styleguidist.github.io/docs/Documenting.html#code-comments

module.exports = {
    componentsRoot: 'packages',
    components: '*/*.vue',
    outDir: './docs',
    defaultExamples: false,
    // getDestFile: (file, config) => {
    //     return path
    //         .resolve(config.outDir, file.match('[a-zA-Z-]*.vue')[0])
    //         .replace(/(.vue)$/, '.md')
    // },
    templates: {
        component: (renderedUsage, doc) => {
            const { displayName, description, docsBlocks, tags, functional } =
                doc;
            const { deprecated, author, since, version, see, link } =
                tags || {};
            return `
---
title: ${displayName}
---
# ${deprecated ? `~~${displayName}~~` : displayName}
${deprecated ? `> **Deprecated** ${deprecated[0].description}\n` : ''}
${description ? '> ' + description : ''}
${functional ? renderedUsage.functionalTag : ''}
${author ? author.map(a => `Author: ${a.description}\n`) : ''}
${since ? `Since: ${since[0].description}\n` : ''}
${version ? `Version: ${version[0].description}\n` : ''}
${see ? see.map(s => `[See](${s.description})\n`) : ''}
${link ? link.map(l => `[See](${l.description})\n`) : ''}
<div class="api">
${renderedUsage.props}
${renderedUsage.methods}
${renderedUsage.events}
${renderedUsage.slots}
</div>
${docsBlocks ? '\n' + docsBlocks.join('\n---\n') : ''}
`;
        },
    },
};
